package com.dy.placeOrder2.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;


import com.dy.placeOrder2.service.GoodsService;

import com.kaoshi.common.config.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.dy.pojo.Goods;


/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2024-11-19
 */
@RestController
@CrossOrigin
@RequestMapping("/goods")
public class GoodsController {

    @Autowired
    private GoodsService goodsService;

    //模拟展示橱窗
    @RequestMapping("/aa/{current}/{pageSize}")
    public Result findAll(@PathVariable Integer current, @PathVariable Integer pageSize,
                          @RequestBody Goods goods) {
        Page<Goods> page = goodsService.findAll(current, pageSize, goods);
        return Result.ok(page);
    }

    //商品详情
    @RequestMapping("/xq/{id}")
    public Result getGoodsDetail(@PathVariable Integer id) {
        Goods goods = goodsService.findById(id);
        return Result.ok(goods);
    }




}
